//
//  RadioConTableViewCell.m
//  SunXi
//
//  Created by dllo on 15/11/27.
//  Copyright © 2015年 大远. All rights reserved.
//

#import "RadioConTableViewCell.h"

@implementation RadioConTableViewCell{
    UIImageView *_myimageView;
    UILabel *_title;
    UILabel *_userlabel;
    UILabel *_heylabel;
    UILabel *_countlabel;
    UIImageView *_sing;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self create];
    }
    return self;
}

- (void)create{
    _myimageView = [[UIImageView alloc]init];
    [SCV addSubview:_myimageView];
    
    _title = [[UILabel alloc]init];
    [SCV addSubview:_title];
    
    _userlabel = [[UILabel alloc]init];
    [SCV addSubview:_userlabel];
    
    _heylabel = [[UILabel alloc]init];
    [SCV addSubview:_heylabel];
    
    _countlabel = [[UILabel alloc]init];
    [SCV addSubview:_countlabel];
    
    _sing = [[UIImageView alloc]init];
    [SCV addSubview:_sing];

}


- (void)layoutSubviews{
    [super layoutSubviews];
    CGFloat hei = CHEIGHT - 10;
    [_myimageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(SCV.mas_left).with.offset(5);
        make.height.mas_equalTo(hei);
        make.width.mas_equalTo(hei);
        make.centerY.equalTo(SCV.mas_centerY);
    }];
    
    [_myimageView sd_setImageWithURL:[NSURL URLWithString:self.model.coverimg] placeholderImage:[UIImage imageNamed:@"zan"]];
    
    
    [_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_myimageView.mas_right).with.offset(5);
        make.top.equalTo(SCV).with.offset(5);
        make.height.equalTo(@20);
        make.width.equalTo(@200);
    }];
    
    _title.text = self.model.title;
    [_userlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_myimageView.mas_right).with.offset(5);
        make.top.equalTo(_title.mas_bottom).offset(10);
        make.height.equalTo(@20);
        make.width.equalTo(@200);
        
    }];
    _userlabel.text = [NSString stringWithFormat:@"by:%@",self.model.userinfo[@"uname"]];
    _userlabel.textColor = BUTTONCOLOR;
    _userlabel.font = [UIFont systemFontOfSize:12];
    
    
    [_heylabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_myimageView.mas_right).with.offset(5);
        make.top.equalTo(_userlabel.mas_bottom).offset(10);
        make.height.equalTo(@20);
        make.width.equalTo(@1000);
        
    }];
    
    _heylabel.text = self.model.desc;
    _heylabel.textColor = [UIColor colorWithRed:0.339 green:0.331 blue:0.355 alpha:0.800];
    _heylabel.font = [UIFont systemFontOfSize:11];
    
    
    [_countlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(SCV).with.offset(-7);
        make.height.mas_equalTo(@20);
        make.width.mas_equalTo(@100);
        make.top.equalTo(SCV.mas_top).offset(5);
        
    }];
    
    _countlabel.text = [NSString stringWithFormat:@"阅:%@",self.model.count];
    _countlabel.textColor = [UIColor colorWithRed:0.339 green:0.331 blue:0.355 alpha:0.800];
    _countlabel.font = [UIFont systemFontOfSize:12];
    _countlabel.textAlignment = NSTextAlignmentRight;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
